<%
/*Auther name      : Frederic Anand
  file name        : 500.jsp
  date modified    : 17-Feb-2009
  revision history :
*/
%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.ba360.portal.database.dbo.SearchAgent" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%
	com.ba360.portal.database.dbo.User user = (com.ba360.portal.database.dbo.User)session.getAttribute("USER");
	if (user==null)
	{
	request.setAttribute("USER_NOT_LOGGED_IN","UNPLUGGED");
	%>
	<jsp:forward page="/portal/login.do"/>
	<%}%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>droik.com</title>
<link href="../css/sample1.css" rel="stylesheet" type="text/css">
<style type="text/css">
	<!--
	body {
		background-image: url(../images/main_bg2.gif);
	}
	.style2 {color: #88DB23}
	.style3 {color: #FFFFFF}
	.style10 {color: #CC3300}
	-->
</style>
</head>
<script>
	function cancel() 
	{
		var url = "../jsp/SearchAgentMain.jsp";
		window.location.href = url;
	}
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<jsp:include page="top.jsp"/>
<br>
<table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td><img src="../images/classifieds_tab.gif" width="720" height="76" border="0" usemap="#Map" href="../portal/index.do"></td>
	</tr>
  	<tr>
		<td background="../images/border_bg2.gif">
			<table width="680" border="0" align="center" cellpadding="0" cellspacing="0">
      				<%
				ArrayList searchAgents = null;
				if (session.getAttribute("EDITAGENT") != null) 
				{
					searchAgents = (ArrayList) session.getAttribute("EDITAGENT");
				}
				if(searchAgents==null || searchAgents.size()==0) 
				{
			%>
				There is no search agent created by you.
			<%
				} 
				else 
				{
					for(int i=0; i<searchAgents.size(); i++) 
					{
						SearchAgent agent = (SearchAgent) searchAgents.get(i);
			%>
						<tr>
							<td align="center"></td>
						</tr>
						<tr>
							<td colspan="5">
						  		<table border="0" cellpadding="3" cellspacing="1" width="100%" class="text"  bgcolor="#99CC33">
									<tr>
										<td width="27%"></td>
										<td width="13%"></td>
									</tr>
									<tr class="text">
										<td  align="right" class="boldtext" nowrap height="24" bgcolor="#FFFFFF">
										<div align="justify"><font class="label">Required Keywords:</font></div></td>
										<td bgcolor="#FFFFFF" > <div align="justify"><input type="text" id="keyword" value="<%=agent.getKeywords()%>" name="keyword"/><SUP>*</SUP></div></td>
									</tr>
										<script>
											function submit() 
											{
												var url = "../portal/ModifySearchAgent.do?action=MODIFY_AGENT&updkeywords=" + document.getElementById('keyword').value + "&orgkeywords=" + "<%=agent.getKeywords()%>" + "&matchtype=" + document.getElementById('matchtype').value + "&timeframe=" + document.getElementById('timeframe').value;
												window.location.href = url;
											}
										</script>
									<tr class="text">
										<%
									   if(agent.getMatchtype() == 1) 
									   {
										%>
										<td  align="right" class="boldtext" nowrap height="24" bgcolor="#FFFFFF">
										<div align="justify"><font class="label">Ads Must Match:</font></div></td>
							  			<td bgcolor="#FFFFFF" > <div align="justify"><select id="matchtype" name="matchtype"><option selected value="1">All of my keywords</option><option value="2">Any of my keywords</option></select> <SUP>*</SUP></div></td>
										<%
									   } 
									   else 
									   {
										%>
										<td  align="right" class="boldtext" nowrap height="24" bgcolor="#FFFFFF">
											<div align="justify"><font class="label">Ads Must Match:</font></div>
										</td>
							  			<td bgcolor="#FFFFFF" > 
							  			     <div align="justify">
							  				<select id="matchtype" name="matchtype">
							  					<option value="1">All of my keywords</option>
							  					<option selected  value="2">Any of my keywords</option>
							  				</select> <SUP>*</SUP>
							  			      </div>
							  			  </td>
										<%
									   }
										%>
									</tr>
									<tr class="text">
										<td  align="right" class="boldtext" nowrap height="24" bgcolor="#FFFFFF">
											<div align="justify"><font class="label">Time Frame to Keep the agent (Example: Enter 10 for 10 days):</font></div></td>
										<td bgcolor="#FFFFFF" > 
											<div align="justify">
												<input type="text" id="timeframe" value="<%=agent.getTimeframe()%>" name="timeframe"/><SUP>*</SUP>
											</div>
										</td>
									</tr>
									<tr class="text">
										<td bgcolor="#FFFFFF" align="right" valign="top" >
											<div><input type="button"  onClick="javascript:submit()" value="Modify Agent"> 
											</div>
										</td>
										<td bgcolor="#FFFFFF" align="left" valign="top" >
											<div><input name="Back" value="Cancel" onClick="javascript:cancel()" type="button"> </div>
										</td>
									</tr>
								</table>
							</td>
        					</tr>
			<%
					}
				}
			%>
			</table>
    		</td>
  	</tr>
	<tr>
		<td><img src="../images/border_bot2.gif" width="719" height="20"></td>
	</tr>
</table>
 <br>
 <br>
<jsp:include page="../jsp/footer.html"/>
<map name="Map">
  <area shape="rect" coords="131,4,204,74" href="../portal/activities.do">
  <area shape="rect" coords="212,5,292,76" href="../portal/attractions.do">
  <area shape="rect" coords="298,7,367,77" href="../portal/deals.do">
  <area shape="rect" coords="39,10,110,83" href="../jsp/index.jsp">
</map>
</body>
</html>
